###############################################
CFG = Debug
ifndef CFG
	CFG = Release
endif
ifeq ($(CFG), Debug)
	CFLAGS = -g -Wall -D_DEBUG
else
	CFLAGS = -O2 -Wall -DNDEBUG
endif

CC = gcc
CXX = g++

CFLAGS += -I../
TARGET = test
LIBS = ../lib/libksisort.so

SOURCE = $(wildcard *.c *.cpp)
OBJS = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(SOURCE)))

all:${TARGET}
	@echo ""
	@echo "############## [$^] ##########"
	@echo ""

$(TARGET):$(OBJS)
	$(CXX) ${CFLAGS} -o $(TARGET) $(OBJS) $(LIBDIR) $(LIBS)

%.o:%.c
	${CC} ${INCLUDES} -c ${CFLAGS} $<

%.o:%.cpp
	$(CXX) ${INCLUDES} -c ${CFLAGS} $<

clean :
	rm -f $(TARGET) *.o
